// (c) 2007 Messaging Logic. All Rights Reserved.
package org.xi8ix.loader;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * @author Iain Shigeoka
 */
class JettyLogWrapper implements org.mortbay.log.Logger {
    private Logger log;
    private boolean debug;

    JettyLogWrapper(String name) {
        if (name == null) {
            log = Logger.getLogger("org.mortbay.jetty");
        } else {
            log = Logger.getLogger(name);
        }
        debug = log.isLoggable(Level.FINEST);
    }

    public boolean isDebugEnabled() {
        return debug;
    }

    public void setDebugEnabled(boolean enabled) {
        this.debug = enabled;
    }

    public void info(String string, Object object, Object object1) {
        log.log(Level.FINER,string,new Object[]{object,object1});
    }

    public void debug(String string, Throwable throwable) {
        log.log(Level.FINER,string,throwable);
    }

    public void debug(String string, Object object, Object object1) {
        log.log(Level.FINEST,string,new Object[]{object,object1});
    }

    public void warn(String string, Object object, Object object1) {
        log.log(Level.INFO,string,new Object[]{object,object1});
    }

    public void warn(String string, Throwable throwable) {
        log.log(Level.INFO,string,throwable);
    }

    public org.mortbay.log.Logger getLogger(String name) {
        return new JettyLogWrapper(name);
    }
}
